package com.yunhe.authority.service.wechat;

import com.yunhe.authority.domain.company.Employee;
import com.yunhe.authority.domain.wechat.Code2Session;
import com.yunhe.authority.domain.wechat.EmployeeDTO;
import com.yunhe.authority.domain.wechat.WXPhoneInfoDTO;
import com.yunhe.authority.domain.wechat.WechatLoginDTO;
import com.yunhe.authority.model.wechat.StationByDistanceVo;
import com.yunhe.common.exception.ArgumentErrorException;
import com.yunhe.common.exception.ObjectNotFoundException;
import com.yunhe.common.exception.UsernamePasswordException;
import org.springframework.web.bind.annotation.RequestBody;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author zhengbo
 * @date 2021/3/1 11:30
 */
public interface WechatService {

    /**
     * 去微信那边获取用户信息
     * @param js_code
     * @return Code2Session
     * @throws IOException
     */
    Code2Session getAuthInfo(String js_code) throws IOException, ArgumentErrorException;

    String getPhone(WXPhoneInfoDTO wxPhoneInfoDTO);

    /**
     * 根据定位返回园区列表
     * @param longitude 经度
     * @param latitude  纬度
     * @return List<StationByDistanceVo>
     */
    List<StationByDistanceVo> getStationByPosition(Double longitude, Double latitude);

    /**
     * 根据手机号和密码登录
     * @param phone
     * @param password
     * @return Map
     * @exception UsernamePasswordException
     */
    WechatLoginDTO loginByPhoneAndPassword(String phone, String password, String openid) throws UsernamePasswordException, ObjectNotFoundException;

    /**
     * 根据手机号和验证码登录
     * @param phone 手机号
     * @param verificationCode 验证码
     * @return Map
     * @exception UsernamePasswordException
     */
    WechatLoginDTO loginByPhoneAndVerificationCode(String phone, String verificationCode, String openid) throws ArgumentErrorException, ObjectNotFoundException;

    /**
     * 忘记密码
     * @param phone
     * @param verificationCode
     * @param password
     * @throws ArgumentErrorException
     */
    void changePassword(String phone, String verificationCode, String password)  throws ArgumentErrorException;

    /**
     * 切换园区
     * @param employeeDTO
     */
    void switchEnterprise(EmployeeDTO employeeDTO);

    /**
     * 上传头像
     * @param phone 手机号
     * @param photoUrl  头像地址
     */
    void uploadPhoto(String phone, String photoUrl);
}
